<extend name="work/base" />
<block name="content">
    <form class="layui-form inline-form">
        <div class="pull-left">
            <div class="layui-inline dropdown">
                <input name="title" class="layui-input" type="text"  id="scheck_time" placeholder="项目名称或登录名称">
            </div>
            <div class="layui-inline">
                <button class="layui-btn  layui-btn-normal" lay-submit lay-filter="search_btn"><i
                        class="layui-icon">&#xe615;</i>搜索
                </button>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-normal  ajax-form" data-url="{:url('add')}"><i class="layui-icon">&#xe61f;</i> 新增</button>
            </div>
        </div>
    </form>
    <table class="layui-table text-center" id="list" lay-filter="list" list-url="{:url('lists')}" edit-url="{:url('editform')}" assigned-url="{:url('editcategory')}" del-url="{:url('delete')}" delinfo-url="{:url('delete')}"></table>
</block>

<block name="script">
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"> <i class="fa fa-trash-o"></i> 删除</a>
    </script>
    <script type="text/html" id="titleTpl">
        <a href="{:url('/project/projectadmin/index/project_id/')}{{d.project_id}}" class="layui-table-link">{{d.title}}</a>
    </script>

    <script type="text/javascript">
        layui.use([ 'element', 'table','form'], function(){
            var table = layui.table
                ,form=layui.form;
            table.render({
                elem: '#list'
                ,url:"{:Url('lists')}"
                ,toolbar: '<div></div>'
                ,page:true
                ,loading:true
                ,title:'品牌表'
                ,limit:20
                ,defaultToolbar: ['filter', 'print', 'exports']
                ,cols: [[
                    {field:'title',  title: '项目名称',templet: '#titleTpl'}
                    ,{field:'user_type', width:110, title: '用户类型'}
                    ,{field:'nickname', width:150, title: '用户名称'}
                    ,{field:'work_wage', width:110, title: '绩效基数'}
                    ,{field:'c_time', width:120, title: '添加时间'}
                    ,{fixed: 'right', width:90,title:'操作',  toolbar:'#barDemo'}
                ]]
            });
            form.on('submit(search_btn)', function (data) {
                table.reload('list', {
                    url: "{:Url('lists')}"
                    , page: {
                        curr: 1
                    }
                    , where: data.field
                });
                return false;
            });
            form.on('select(status)', function (data) {
                table.reload('list', {
                    url: "{:Url('lists')}"
                    , page: {
                        curr: 1
                    }
                    , where: {
                        status: data.value
                    }
                });
                return false;
            });
        });
    </script>
</block>
